# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=chromaprint
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2
pkgrel=2
pkgdesc="Library that implements a custom algorithm for extracting fingerprints from any audio source (mingw-w64)"
arch=('any')
url="http://acoustid.org/chromaprint/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake")
depends=("${MINGW_PACKAGE_PREFIX}-ffmpeg")
options=('strip' 'staticlibs')
source=("https://bitbucket.org/acoustid/${_realname}/downloads/${_realname}-${pkgver}.tar.gz")
sha256sums=('822b8949a322ac04c6f8a3ed78f5e689bcc493c6ca0972bf627c913c8430031a')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  #patch -p1 -i ${srcdir}/001-no-undefined.patch
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_AVFFT=ON \
    ../${_realname}-${pkgver}

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
